 using BitBenderGames;
using DG.Tweening;
using System;
using System.Collections.Generic;
using UnityEngine;
using Yoozoo.Mars.Got.Timer;

namespace Yoozoo.Gameplay.City
{
    public class CityHallLightColorController : MonoBehaviour
    {
        // 灯光节点 { [0]={Normal, Carnival}, [1]=... }
        [SerializeField]
        List<Transform> _Lights;
        
        // 当前品质
        [SerializeField]
        private int _CurrentIndex = 0;

        void Awake()
        {
            SetCurrentIndex(0);
        }

        public void Reset()
        {
            foreach (var lightTransform in _Lights)
            {
                if (lightTransform && lightTransform.gameObject.activeSelf)
                {
                    lightTransform.gameObject.SetActive(false);
                }
            }
        }
        
        public void SetCurrentIndex(int index)
        {
            if (0<=index && index<_Lights.Count)
            {
                _CurrentIndex = index;
            }
            else
            {
                _CurrentIndex = 0;
            }
            
            Reset();
            if (_Lights.Count > 0 && _Lights[_CurrentIndex])
            {
                _Lights[_CurrentIndex].gameObject.SetActive(true);
            }
        }

        // /// <summary>
        // /// 设置当前Animator
        // /// </summary>
        // /// <param name="index"></param>
        // public void SetAnimatorIndex(int index)
        // {
        //     if (index < _LightAnimators.Count)
        //     {
        //         _CurrentAnimator = _LightAnimators[index];
        //     }
        //     else
        //     {
        //         _CurrentAnimator = _LightAnimators[0];
        //     }
        // }
        //
        // /// <summary>
        // /// 触发动画
        // /// </summary>
        // /// <param name="triggerName"></param>
        // public void SetAnimatorTrigger(string triggerName)
        // {
        //     _CurrentTriggerName = triggerName;
        //     if (_CurrentAnimator != null)
        //     {
        //         _CurrentAnimator.SetTrigger(triggerName);
        //     }
        // }
        
    }
}
